Moved trim to the correct place
Fixed crash on PM