Random bug fixes in model