better error handling and fixed provdrop