Fixed some further bugs, added correct javascript behaviour