Better error handling. Fix firefox detection.