Little improvements

Small fixes and added handling for custom user types (instead of throwing exception with USER-DEFINED type not found)