Fixed a bug that caues incorrect canvas dimensions to be returned.