Fixing up some bugs that maybe should be handled in javascript