Fixed some issues with memory handlers.