changed if statement to satisfy jshint