fixed bug in engine