Fixed JSHint warnings
Fixed bug