Javascript Bug Fixes