try using debugging mode and see where it doesnot print,the code seems prety fine