Fixed canvas resize bug