fixed bug (thanks Simon)