javascript return broken