Critical bugs fixed

some caused crashes due to uninitialized canvas pointer.