fixed logical error, thanks Drood