fixed bug (not yet finished)