change assert to throw with proper error message
remove unnecessary allocations in gmmmap