Fixed two problems pointed out by Himanshu Gupta