Fixes allocation algorithm. Fixes check instance statement.