Declare the PK
Fix mistake, only log when engine is running