Backend bug fixes