Fixed optimization, thanks @jpeg729