Fixed bug 1002605 and filed bugs 1002605 and 1002591