fixed some js naming conventions, check for null