changed if statement for 10 to ===, works correctly now