Backend backport

several issues I've fixed while working on backend