fixed bugs engine now works