fixed some backend logic