backward compatibility
improve error handling