fixes for registerdatalocation, first unit tests for register writing