Fixed NullPointerException when drawing