fix design slightly and adjust error handling