revert changes back to commit 'd99e09c' and rework fixes properly