Added some bug fixes to Javascript file and print preview page