use call instead of apply - thus stop creating arbitrary arrays
add missing semicolons