javascript error: Uncaught TypeError: Cannot read property '1' of null