Fixed bug which calculated a wrong allocation size