Trying to fix javascript error