Fixes param checking and improves errors