fixed a bug, added errorHandler for dev mode